Allow modules to return a value and access each other's value.#707
Allow modules to return a value and access each other's value.#707
Conversation
jwildfire
left a comment
There was a problem hiding this comment.
Left a few questions for you @samussiah. In short, I think I'd scale this back a little bit for now. We can think about a more complex implementation later.
Also need to update the @value in the roxygen header to describe what is being returned.
Happy to chat if needed.
| module_outputs | ||
| ) | ||
| } else { | ||
| module_output <- output[["chart-wrap"]] <- chart$functions$server( |
There was a problem hiding this comment.
Is anything actually being returned here for non-shiny charts? I guess in theory the main function could return something, but is this just NULL for now?
There was a problem hiding this comment.
Right, nothing now... I can imagine returning a filtered/transformed dataset or a population subset.
R/mod_chartsTab.R
Outdated
| #' @export | ||
|
|
||
| chartsTab <- function(input, output, session, chart, data, mapping){ | ||
| chartsTab <- function(input, output, session, chart, data, mapping, module_outputs) { |
There was a problem hiding this comment.
Is the idea that this is all of outputs from the other charts? Is this reactive? Are you using this for anything right now? Wondering if we could trigger an infinite loop with this somehow ...
There was a problem hiding this comment.
I'm imagining a module that aggregates output from other modules, each with its own set of inputs.
| mapping=current_mapping | ||
| ) | ||
| ) | ||
| module_outputs <- reactiveValues() |
There was a problem hiding this comment.
reactiveValues is actually what's working. It allows passing around a single, updateable object of reactive modules.
| chart=chart, | ||
| data=filtered_data, | ||
| mapping=current_mapping, | ||
| module_outputs=module_outputs |
There was a problem hiding this comment.
should this be module_outputs1?
There was a problem hiding this comment.
Deleted the module_outputs of returned map output.
R/mod_safetyGraphicsServer.R
Outdated
| #Setting tab | ||
| callModule(settingsTab, "settings", domains = domainData, metadata=meta, mapping=current_mapping, charts = charts) | ||
|
|
||
| return(module_outputs1) |
There was a problem hiding this comment.
I don't think we want to return this from the overall server function ...
R/safetyGraphicsApp.R
Outdated
| ) | ||
|
|
||
| server <- function(input, output, session) { | ||
| module_outputs <- callModule( |
There was a problem hiding this comment.
Don't think we want to do this.
There was a problem hiding this comment.
If we have the server function return something, I'd think it should be a larger config including meta, mapping etc. For now, I don't think the overall server function is well designed to be used as part of a larger app, so I'd lean towards not implementing this for now.
No description provided.